<?php
namespace app\api\controller\yop;

use customtool\Utils;

class Order extends Base {
    public function test() {
        return json_encode(Utils::objectToArray('密钥不可用'), 320);
    }
    
    public function index() {
        date_default_timezone_set('Asia/Shanghai');
        $orderId = 'CY' . date('YmdHis', time()) . rand(10, 99);
        $this->assign('orderId', $orderId);
        return $this->fetch();
    }
    
    public function send() {
        $data = input('post.');
        $data['merchant_id'] =  $this->C('merchantId');
        $data['signature'] = apiChangyuanSign($data, $this->C('md5key'));  // 创建签名
        $result = Utils::curl($this->C('orderUrl'), $data);
        return $result;
    }
}
